home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 4
/
United Public Domain Gold 4.iso
/
fredfish
/
ff.0014.dms
/
ff.0014.adf
/
dex
/
dex.lo
< prev
next >
Wrap
Text File
|
1990-04-10
|
11KB
|
619 lines
/* # include "stdio.h" **** WARNING **** hand modified, MANX C does not
like having stdio.h included twice!! ***/
# define U(x) x
# define NLSTATE yyprevious=YYNEWLINE
# define BEGIN yybgin = yysvec + 1 +
# define INITIAL 0
# define YYLERR yysvec
# define YYSTATE (yyestate-yysvec-1)
# define YYOPTIM 1
# define YYLMAX 200
# define output(c) putc(c,yyout)
# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
# define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
# define yymore() (yymorfg=1)
# define ECHO fprintf(yyout, "%s",yytext)
# define REJECT { nstr = yyreject(); goto yyfussy;}
int yyleng; extern char yytext[];
int yymorfg;
extern char *yysptr, yysbuf[];
int yytchar;
FILE *yyin = {stdin}, *yyout = {stdout};
extern int yylineno;
struct yysvf {
struct yywork *yystoff;
struct yysvf *yyother;
int *yystops;};
struct yysvf *yyestate;
extern struct yysvf yysvec[], *yybgin;
/************************************************************************
* *
* Copyright (c) 1982, Fred Fish *
* All Rights Reserved *
* *
* This software and/or documentation is released for public *
* distribution for personal, non-commercial use only. *
* Limited rights to use, modify, and redistribute are hereby *
* granted for non-commercial purposes, provided that all *
* copyright notices remain intact and all changes are clearly *
* documented. The author makes no warranty of any kind with *
* respect to this product and explicitly disclaims any implied *
* warranties of merchantability or fitness for any particular *
* purpose. *
* *
************************************************************************
*/
/*
* FILE
*
* dex.l lex specification for documentation extraction utility
*
* KEY WORDS
*
* lex specification
* dex
*
* SYNOPSIS
*
* lex dex.l
* mv lex.yy.c dex.lo
*
* DESCRIPTION
*
* This file contains the lex specification for the "dex"
* documentation extraction utility. It is used with the file
* "dex.y", which is the yacc specification, to generate the
* source file parser.
*
* AUTHOR
*
* Fred Fish
*
*/
# define DLINE 2
# define YYNEWLINE 10
yylex(){
int nstr; extern int yyprevious;
extern int debug;
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:
{
BEGIN DLINE;
if (debug) {printf("yylex: HSTART \"%s\"\n",yytext);}
return(HSTART);
}
break;
case 2:
{
BEGIN DLINE;
if (debug) {printf("yylex: FSTART \"%s\"\n",yytext);}
return(FSTART);
}
break;
case 3:
{
BEGIN DLINE;
if (debug) {printf("yylex: UFSTART \"%s\"\n",yytext);}
return(UFSTART);
}
break;
case 4:
{
BEGIN 0;
if (debug) {printf("yylex: BSTART \"%s\"\n",yytext);}
return(BSTART);
}
break;
case 5:
{
if (debug) {printf("yylex: TEXT \"%s\"\n",yytext);}
return(TEXT);
}
break;
case 6:
{
BEGIN 0;
if (debug) {printf("yylex: NEWLINE \"%s\"\n",yytext);}
return(NEWLINE);
}
break;
case 7:
{
BEGIN 0;
if (debug) {printf("yylex: JUNK1 \"%s\"\n",yytext);}
return(JUNK);
}
break;
case 8:
{
BEGIN 0;
if (debug) {printf("yylex: JUNK2 \"%s\"\n",yytext);}
return(JUNK);
}
break;
case 9:
{
BEGIN 0;
if (debug) {printf("yylex: JUNK3 \"%s\"\n",yytext);}
return(JUNK);
}
break;
case 10:
{
BEGIN 0;
if (debug) {printf("yylex: JUNK4 \"%s\"\n",yytext);}
return(JUNK);
}
break;
case -1:
break;
default:
fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
/* end of yylex */
extern FILE *infp;
#undef input /* Make preprocessor forget macro */
input()
{
char ch;
ch = fgetc(infp);
switch(ch) {
case EOF:
ch = NULL;
break;
case NULL:
ch = '\n';
break;
}
ch &= '\177';
return(ch);
}
#undef unput /* Make preprocessor forget macro */
unput(ch)
char ch;
{
if (ch == NULL) {
ch = EOF;
}
ungetc(ch,infp);
}
int yyvstop[] = {
0,
5,
0,
5,
0,
5,
0,
5,
0,
10,
0,
6,
10,
0,
10,
11,
0,
8,
10,
0,
10,
-7,
0,
8,
10,
11,
0,
10,
-4,
0,
5,
10,
0,
5,
10,
11,
0,
5,
8,
10,
0,
5,
10,
-7,
0,
5,
8,
10,
11,
0,
5,
10,
-4,
0,
8,
0,
-7,
0,
7,
0,
-4,
0,
9,
0,
2,
-4,
0,
4,
0,
-4,
0,
5,
0,
5,
8,
0,
5,
-7,
0,
5,
-4,
0,
5,
9,
0,
2,
5,
-4,
0,
5,
-4,
0,
3,
-4,
0,
-4,
0,
1,
-4,
0,
3,
5,
-4,
0,
5,
-4,
0,
1,
5,
-4,
0,
0};
# define YYTYPE char
struct yywork { YYTYPE verify, advance; } yycrank[] = {
0,0, 0,0, 1,5, 0,0,
2,8, 0,0, 3,12, 0,0,
4,14, 0,0, 1,5, 1,6,
2,9, 1,7, 3,12, 2,10,
4,15, 3,13, 8,18, 4,16,
9,19, 9,20, 10,0, 11,22,
13,0, 12,26, 8,18, 8,0,
16,0, 15,28, 15,20, 11,23,
11,24, 12,26, 12,0, 14,27,
1,5, 17,30, 2,11, 18,0,
3,12, 21,25, 4,17, 14,27,
14,0, 17,31, 9,21, 19,19,
19,20, 23,33, 23,24, 25,34,
8,18, 22,22, 11,25, 15,29,
26,0, 11,22, 27,0, 12,26,
33,34, 22,22, 22,0, 28,28,
28,20, 31,36, 31,24, 29,30,
17,32, 14,27, 30,30, 17,30,
23,34, 19,21, 25,35, 29,31,
32,37, 32,24, 30,30, 30,0,
34,34, 0,0, 35,34, 36,37,
36,24, 37,37, 37,24, 22,22,
31,37, 28,29, 38,37, 38,24,
0,0, 0,0, 0,0, 0,0,
0,0, 0,0, 29,32, 32,38,
0,0, 29,30, 0,0, 0,0,
30,30, 35,35, 0,0, 0,0,
0,0, 0,0, 0,0, 0,0,
0,0, 38,38, 0,0, 0,0,
0,0};
struct yysvf yysvec[] = {
0, 0, 0,
yycrank+-1, 0, yyvstop+1,
yycrank+-3, yysvec+1, yyvstop+3,
yycrank+-5, yysvec+1, yyvstop+5,
yycrank+-7, yysvec+1, yyvstop+7,
yycrank+0, 0, yyvstop+9,
yycrank+0, 0, yyvstop+11,
yycrank+0, 0, yyvstop+14,
yycrank+-17, 0, yyvstop+17,
yycrank+-11, yysvec+8, yyvstop+20,
yycrank+-12, yysvec+8, yyvstop+23,
yycrank+-22, 0, yyvstop+27,
yycrank+-24, 0, yyvstop+30,
yycrank+-14, yysvec+12, yyvstop+33,
yycrank+-34, 0, yyvstop+37,
yycrank+-20, yysvec+14, yyvstop+41,
yycrank+-18, yysvec+14, yyvstop+45,
yycrank+-36, yysvec+11, yyvstop+50,
yycrank+-29, yysvec+8, yyvstop+54,
yycrank+-38, yysvec+8, yyvstop+56,
yycrank+0, 0, yyvstop+58,
yycrank+-9, yysvec+11, yyvstop+60,
yycrank+-52, 0, yyvstop+62,
yycrank+40, 0, yyvstop+64,
yycrank+0, 0, yyvstop+67,
yycrank+42, yysvec+23, yyvstop+69,
yycrank+-46, yysvec+12, yyvstop+71,
yycrank+-48, yysvec+14, yyvstop+73,
yycrank+-54, yysvec+14, yyvstop+76,
yycrank+-66, yysvec+11, yyvstop+79,
yycrank+-69, 0, yyvstop+82,
yycrank+-56, yysvec+12, yyvstop+85,
yycrank+-67, yysvec+12, yyvstop+89,
yycrank+51, yysvec+23, yyvstop+92,
yycrank+71, yysvec+23, yyvstop+95,
yycrank+73, yysvec+23, yyvstop+97,
yycrank+-74, yysvec+12, yyvstop+100,
yycrank+-76, yysvec+12, yyvstop+104,
yycrank+-81, yysvec+12, yyvstop+107,
0, 0, 0};
struct yywork *yytop = yycrank+113;
struct yysvf *yybgin = yysvec+1;
char yymatch[] = {
00 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
01 ,011 ,012 ,01 ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
011 ,01 ,01 ,'#' ,01 ,01 ,01 ,01 ,
01 ,01 ,'#' ,01 ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,'#' ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
01 ,01 ,01 ,01 ,'#' ,01 ,01 ,01 ,
0};
char yyextra[] = {
0,0,0,0,1,0,0,1,
0,0,0,0,0,0,0,0,
0};
/* @(#)ncform 1.2 */
int yylineno =1;
# define YYU(x) x
# define NLSTATE yyprevious=YYNEWLINE
char yytext[YYLMAX];
struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
char yysbuf[YYLMAX];
char *yysptr = yysbuf;
int *yyfnd;
extern struct yysvf *yyestate;
int yyprevious = YYNEWLINE;
yylook(){
register struct yysvf *yystate, **lsp;
register struct yywork *yyt;
struct yysvf *yyz;
int yych, yyfirst;
struct yywork *yyr;
# ifdef LEXDEBUG
int debug;
# endif
char *yylastch;
/* start off machines */
# ifdef LEXDEBUG
debug = 0;
# endif
yyfirst=1;
if (!yymorfg)
yylastch = yytext;
else {
yymorfg=0;
yylastch = yytext+yyleng;
}
for(;;){
lsp = yylstate;
yyestate = yystate = yybgin;
if (yyprevious==YYNEWLINE) yystate++;
for (;;){
# ifdef LEXDEBUG
if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
# endif
yyt = yystate->yystoff;
if(yyt == yycrank && !yyfirst){ /* may not be any transitions */
yyz = yystate->yyother;
if(yyz == 0)break;
if(yyz->yystoff == yycrank)break;
}
*yylastch++ = yych = input();
yyfirst=0;
tryagain:
# ifdef LEXDEBUG
if(debug){
fprintf(yyout,"char ");
allprint(yych);
putchar('\n');
}
# endif
yyr = yyt;
if ( (int)yyt > (int)yycrank){
yyt = yyr + yych;
if (yyt <= yytop && yyt->verify+yysvec == yystate){
if(yyt->advance+yysvec == YYLERR) /* error transitions */
{unput(*--yylastch);break;}
*lsp++ = yystate = yyt->advance+yysvec;
goto contin;
}
}
# ifdef YYOPTIM
else if((int)yyt < (int)yycrank) { /* r < yycrank */
yyt = yyr = yycrank+(yycrank-yyt);
# ifdef LEXDEBUG
if(debug)fprintf(yyout,"compressed state\n");
# endif
yyt = yyt + yych;
if(yyt <= yytop && yyt->verify+yysvec == yystate){
if(yyt->advance+yysvec == YYLERR) /* error transitions */
{unput(*--yylastch);break;}
*lsp++ = yystate = yyt->advance+yysvec;
goto contin;
}
yyt = yyr + YYU(yymatch[yych]);
# ifdef LEXDEBUG
if(debug){
fprintf(yyout,"try fall back character ");
allprint(YYU(yymatch[yych]));
putchar('\n');
}
# endif
if(yyt <= yytop && yyt->verify+yysvec == yystate){
if(yyt->advance+yysvec == YYLERR) /* error transition */
{unput(*--yylastch);break;}
*lsp++ = yystate = yyt->advance+yysvec;
goto contin;
}
}
if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
# ifdef LEXDEBUG
if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
# endif
goto tryagain;
}
# endif
else
{unput(*--yylastch);break;}
contin:
# ifdef LEXDEBUG
if(debug){
fprintf(yyout,"state %d char ",yystate-yysvec-1);
allprint(yych);
putchar('\n');
}
# endif
;
}
# ifdef LEXDEBUG
if(debug){
fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
allprint(yych);
putchar('\n');
}
# endif
while (lsp-- > yylstate){
*yylastch-- = 0;
if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
yyolsp = lsp;
if(yyextra[*yyfnd]){ /* must backup */
while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
lsp--;
unput(*yylastch--);
}
}
yyprevious = YYU(*yylastch);
yylsp = lsp;
yyleng = yylastch-yytext+1;
yytext[yyleng] = 0;
# ifdef LEXDEBUG
if(debug){
fprintf(yyout,"\nmatch ");
sprint(yytext);
fprintf(yyout," action %d\n",*yyfnd);
}
# endif
return(*yyfnd++);
}
unput(*yylastch);
}
if (yytext[0] == 0 /* && feof(yyin) */)
{
yysptr=yysbuf;
return(0);
}
yyprevious = yytext[0] = input();
if (yyprevious>0)
output(yyprevious);
yylastch=yytext;
# ifdef LEXDEBUG
if(debug)putchar('\n');
# endif
}
}
yyback(p, m)
int *p;
{
if (p==0) return(0);
while (*p)
{
if (*p++ == m)
return(1);
}
return(0);
}
/* the following are only used in the lex library */
yyinput(){
return(input());
}
yyoutput(c)
int c; {
output(c);
}
yyunput(c)
int c; {
unput(c);
}